renderbackground: Use new snapshot transforms
authorBenjamin Otte <otte@redhat.com>
Thu, 21 Feb 2019 04:34:12 +0000 (05:34 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 21 Feb 2019 18:47:28 +0000 (19:47 +0100)
gtk/gtkrenderbackground.c

index 32e0305cab2c2cfb642f1447ec3a70dc63c20e91..ae04ab3bac132ea26947e48278393c22bd67987c 100644 (file)
@@ -144,7 +144,7 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
   gtk_snapshot_push_debug (snapshot, "Layer %u", idx);
   gtk_snapshot_push_rounded_clip (snapshot, clip);
 
-  gtk_snapshot_offset (snapshot, origin->bounds.origin.x, origin->bounds.origin.y);
+  gtk_snapshot_translate (snapshot, &origin->bounds.origin);
 
   if (hrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT && vrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT)
     {
@@ -154,11 +154,12 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
       x = _gtk_css_position_value_get_x (pos, width - image_width);
       y = _gtk_css_position_value_get_y (pos, height - image_height);
 
-      gtk_snapshot_offset (snapshot, x, y);
+      gtk_snapshot_save (snapshot);
+      gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
 
       gtk_css_image_snapshot (image, snapshot, image_width, image_height);
 
-      gtk_snapshot_offset (snapshot, -x, -y);
+      gtk_snapshot_restore (snapshot);
     }
   else
     {
@@ -255,16 +256,14 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
                                     repeat_width, repeat_height
                                 ));
                                 
-      gtk_snapshot_offset (snapshot,
-                           position_x + 0.5 * (repeat_width - image_width),
-                           position_y + 0.5 * (repeat_height - image_height));
+      gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (
+                              position_x + 0.5 * (repeat_width - image_width),
+                              position_y + 0.5 * (repeat_height - image_height)));
       gtk_css_image_snapshot (image, snapshot, image_width, image_height);
 
       gtk_snapshot_pop (snapshot);
     }
 
-  gtk_snapshot_offset (snapshot, - origin->bounds.origin.x, - origin->bounds.origin.y);
-
   gtk_snapshot_pop (snapshot);
   gtk_snapshot_pop (snapshot);
 }